﻿if (typeof Axis == "undefined") Axis = {};
if (typeof Axis.View == "undefined") Axis.View = {};
if (typeof Axis.View.News == "undefined") Axis.View.News = {};

Axis.View.News.Menu = {
    Init: function () {
        var thisObj = this;
        thisObj.TabActive();
        thisObj.Event();
        $(window).load(function () {
            setTimeout(function () {
                thisObj.Tab();
            }, 500);
        });
        
        
    },
    Tab: function () {
        var thisObj = this;
        $(".news_sub_menu_list").carouFredSel({
            width: 600,
            height: 70,
            circular: false,
            infinite: false,
            auto: false,
            align: 'left',
            prev: {
                button: '#foo2_prev',
                key: 'left'
            },
            next: {
                button: '#foo2_next',
                key: 'right'
            }
        });
    },
    TabActive:function(){
        var thisObj = this;
        var catID = CateID;
        $(".news_sub_menu_list img").each(function () {
            var id = $(this).attr("submenu");
            if (catID == id) {
                var _src = $(this).attr("image-active");
                $(this).attr("src", _src);
                var image = $(this).attr("image");
                if (image) {
                    var catnews = $.string.Format("<img class='imgCatNewsActive' src='{0}'/> ", image);
                    $(".newsDetailMiniCatImage").append(catnews);
                }
                var borderColor = $(this).attr("border-color");
                $(".news_sub_menu_container .ui-bar").css("border-top-color", "#" + borderColor);
                $('#MoreInfo').css({ 'border-bottom-color': "#" + borderColor });
            }
        });
    },
    Event: function () {
        var thisObj = this;
        $(".news_sub_menu_list img").click(function () {
            var id = $(this).attr("submenu");
            location.href = location.pathname.substring(0, location.pathname.lastIndexOf('/')) +"/" + id;
        });

    }
};
$(function () {
    Axis.View.News.Menu.Init();
});